export function enumerable(value: boolean) {
  return function (target: any, propertyKey: string, ...rest) {
    const [ descriptor ] = rest
    // console.log(target, propertyKey, descriptor)
    if (descriptor) {
      descriptor.enumerable = value
    } else {
      Object.defineProperty(target, propertyKey, {
        get: function () {
          return undefined
        },
        set: function (val) {
          this[ propertyKey ] = val
        },
        enumerable: value,
      })
    }
  }
}
